<include file="./top" />
<!-- start: Header -->
<include file="./head" />
<!-- end: Header -->
<div class="container-fluid content">
<div class="row"> 
  <!-- start: Main Menu --> 
  <include file="./slide" /> 
  <!-- end: Main Menu --> 
  
  <!-- start: Content -->
  <div class="main sidebar-minified"> 
    <!--div class="row">
      <div class="col-lg-12">
        <h3 class="page-header"><i class="fa fa-table"></i>{$title}</h3>
      </div>
    </div-->

<?php
 if($count >= 5000000){ 
?>
<div class="alert alert-danger" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>友情提示:</strong> 当前数据总和已超过5000000,不建议采用条件搜索! 如果采用条件搜索,将会检索所有数据！速度会非常慢！,(建议你关闭加款日志)
</div>
<?php
 }
?>


<?php
 if(!C("JIAKUAN_LOG")){ 
?>
<div class="alert alert-danger" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>友情提示:</strong> 没有开启加款日志,前期流量不大可以开启,如果流量太大，建议关闭!
</div>
<?php
 }
?>




    <div class="row">
      <div class="col-lg-8">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h2><i class="fa fa-table red"></i><span class="break"></span><strong>{$title}</strong></h2>
            <div class="panel-actions"> <a href="table.html#" class="btn-setting"><i class="fa fa-rotate-right"></i></a> <a href="table.html#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a> </div>
          </div>
          <div class="panel-body">
            <form action="{:U('Jifei/jiakuan_log')}" method="get" class="form-inline">
              <div class="form-group">
                <select class="btn"  name="select" id="select">
                  <option value="0">请选择查询类型</option>
                  <option value ="uid" <?php if(I('get.select')=='uid'){ ?>selected <?php }?>>会员ID</option>
                </select>
              </div>
              <div class="form-group">
                <input name="nr" id="nr" type="text" class="form-control" value="{:I('get.nr')}" />
              </div>
              <div class="form-group"> <span class="btn btn-primary ">按时间查询：</span></div>
              <div class="form-group">
                <input name="act_start_time" id="act_start_time" type="text" class="form-control" value="{:I('get.act_start_time')}" placeholder="开始时间≥当前时间" title="开始时间≥当前时间" readonly="readonly" style="cursor:pointer;"/>
              </div>
              <div class="form-group"> -> </div>
              <div class="form-group">
                <input name="act_stop_time" id="act_stop_time" type="text" class="form-control" value="{:I('get.act_stop_time')}" placeholder="结束时间>开始时间" title="结束时间>开始时间" readonly="readonly" style="cursor:pointer;"/>
              </div>
              <div class="form-group">
                <button type="submit" class="btn btn-primary btn-success" id="but"><i class="fa fa-dot-circle-o"></i> 查询日志</button>
                <button type="button" class="btn btn-primary btn-danger"  id="del"><i class="fa fa-ban"></i> 删除日志</button>
                <?php if($where){?>
                <a href="<?php echo U('Jifei/jiakuan_log');?>" class="btn btn-primary">清楚</a>
                <?php } ?>
              </div>
            </form>
          </div>
          <div class="panel-body">
            <table class="table table-striped table-bordered bootstrap-datatable datatable">
              <thead>
                <tr>
                  <th width="4%">ID</th>
                  <th width="4%">会员ID</th>
                  <th width="8%">计费日志ID</th>
                  <th width="8%">加款时间</th>
                  <th width="4%">单价</th>
                  <th width="4%">总额</th>
                  <th width="8%">上线加款日志</th>
                  <th width="10%">加款信息</th>
                </tr>
              </thead>
              <tbody>
                <?php foreach($log as $v): ?>
                <tr>
                    <td>{$v['id']}</td>
                    <td>{$v['uid']}</td>
                    <td>{$v['jifei_log_id']}</td>
                    <td>{:date("Y-m-d H:i:s",$v['time'])}</td>
                    <td>{$v['price']}</td>
                    <td>{:zonger($v)}</td>
                    <td>
                    <?php if(!empty($v['jiakuan_xiaji_log'])){ ?>
                     <span class="label label-default" href="javascript:void();" onclick="javascript:open_windos('#xiaji_log_{$v['id']}')" >
                     <span  class="fa fa-search-plus"></span>点击查看</span>
                    <?php }else { ?>
                    <span class="label label-success">没有上线</span>
                    <?php } ?>
                    <div style="display:none">
                    <div id="xiaji_log_{$v['id']}">
                    <div class="panel panel-default" style="margin-bottom:0px;">
                        <div class="panel-heading">
                            <h2><i class="fa fa-table red"></i><span class="break"></span><strong>上级加款日志</strong></h2>
                            <div class="panel-actions">
                                <a href="#" class="btn-setting"><i class="fa fa-rotate-right"></i></a>
                                <a href="#" class="btn-minimize"><i class="fa fa-chevron-up"></i></a>
                            </div>
                        </div>
                        <div class="panel-body">
                            <table class="table table-striped">
                                  <thead>
                                      <tr>
                                          <th>会员ID</th>
                                          <th>时间</th>
                                          <th>单价</th>
                                          <th>信息</th>                                          
                                      </tr>
                                  </thead>   
                                  <tbody>
                       
                                 <?php foreach($v['jiakuan_xiaji_log'] as $v2):?>
                                    <tr>
                                        <td>{$v2['uid']}</td>
                                        <td>{:date("Y-m-d H:i:s",$v2['time'])}</td>
                                        <td>{$v2['price']}</td>
                                        <td>
                                            <span class="label label-danger">{$v2['info']}</span>
                                        </td>                                       
                                    </tr>
                                <?php endforeach; ?>

                                  </tbody>
                             </table>     
                        </div>
                    </div>
 

                    </div>
                    </div>
                    </td>
                    <td>{$v['info']}</td>
                </tr>
                <?php endforeach;?>
              </tbody>
            </table>
          </div>
        <div class="panel-body">
        <ul class="pagination">
        {$page}
        </ul>
        </div>
        </div>
        </div>
      <!--/col-->
    </div>
  </div>
</div>
<include file="./foot" />
<style type="text/css">
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 45%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 45% 10px 10px; }
</style>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/jq_time/jquery-ui.css" />
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery-ui-1.10.4.custom.min.js"></script> 
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery.ui.datepicker-zh-CN.js"></script> 
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript" src="__PUBLIC__/jq_time/jquery-ui-timepicker-zh-CN.js"></script> 
<script src="__PUBLIC__/layer/layer.js"></script>
<script type="text/javascript">
$(function(){
    $( "input[name='act_start_time'],input[name='act_stop_time']" ).datetimepicker();
    $("#but").click(function(){
            var act_start_time= $("#act_start_time").val();
		    var act_stop_time= $("#act_stop_time").val();
			var selects = $("#select").val();
			var nr = $("#nr").val();
			if(selects==0 && nr==''){
			   	if(!act_start_time && !act_stop_time){ 
			     yz_alert(0,"查询时间或者查询值必须写一个!");
				 return false;
			    }
			}	
		 });
    //删除
	$("#del").click(function(){
			var act_start_time= $("#act_start_time").val();
			var act_stop_time= $("#act_stop_time").val();
			var selects = $("#select").val();
			var nr = $("#nr").val();
			var info = '确认删除';
		    if(selects==0 && nr==''){
			   	if(!act_start_time && !act_stop_time){ 
			     yz_alert(0,"删除日志时间或者查询值必须写一个!");
				 return false;
			    }
			}else{ 
			 info = info+selects+"等于"+nr+"  ";
			}
		    if(act_start_time && act_stop_time){ 
			  info = info + act_start_time+"到"+act_stop_time;
			 }
			info = info +"的拦截日志吗???";
			if (confirm(info)==true){   
                $.ajax({
					 type:'GET',
					 url:'{:U("Jifei/del_jiakuan_log")}',
					 data:{"act_start_time":act_start_time,"act_stop_time":act_stop_time,"selects":selects,'nr':nr},
					 dataType:"json",
					 success: function(data){
						var data = eval(data);
						yz_alert(data.status,data.info);
				     }
				  })   
             }
		});

});

    //打开提示窗口
function open_windos(divid)
    {   
    layer.open({
    type: 1,
    title: false,
     area: ['700px', ''],
    closeBtn: false,
    shadeClose: true,
    skin: 'yourclass',
    content: $(divid).html(),
    });
  }

</script>
</body>
</html>
